<template>
	<div id="home">
		<div id="main">
			<h2>{{info.title}}</h2>
			<p><span class="left">{{info.add_time | datefmt('YYYY-MM-DD')}}</span><span class="right">{{info.click}}次浏览</span></p>
			<article v-html="info.content"></article>
		</div>
		<comment :id='id'></comment>
	</div>
</template>

<script>
	import { Toast } from 'mint-ui';
	import comment from '../subcom/comment.vue';
	export default {
		components: {
			comment
		},
		data() {
			return {
				id: 0,
				info: {}
			}
		},
		created() {
			this.id = this.$route.params.newsid;
			this.getNewsLists();
		},
		methods: {
			getNewsLists() {
				this.$http.get(this.$common.domain + '/api/getnew/' + this.id).then(function(res) {
					if(res.body.status != 0) {
						Toast({
							message: res.body.message,
							position: 'bottom',
							duration: 3000
						});
						return;
					}
					this.info = res.body.message[0];
				})
			}
		}
	}
</script>

<style scoped>

		
	#home {
		padding: 10px;
	}
	
	h2 {
		font-size: 20px;
		line-height: 1.5em;
	}
	
	#home>p {
		color: gray;
	}
	
	p>.left {
		margin-right: 20px;
	}
	
	
</style>